package com.baikeyang.service.role.impl;

import com.baikeyang.commons.Constants;
import com.baikeyang.commons.bean.ResponseResult;
import com.baikeyang.mapper.RoleMapper;
import com.baikeyang.pojo.Role;
import com.baikeyang.service.role.IRoleService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IDEA
 *
 * @ClassName RoleServiceImpl
 * @Description TODO
 * @Author BaiKeyang
 * @Computer lenovo
 * @Date 2018/9/14 9:51
 * @Version 1.0.0
 */
@Service(value = "roleService")
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {

    private RoleMapper roleMapper;

    @Autowired
    public void setRoleMapper(RoleMapper roleMapper) {
        this.roleMapper = roleMapper;
    }

    @Override
    public ResponseResult getAllRoles() {
        Wrapper<Role> wrapper = new EntityWrapper<Role>();
        List<Role> roles = roleMapper.selectList(wrapper);
        return new ResponseResult(Constants.EXECUTESTATUS.成功, Constants.EXECUTEINFO.成功, Constants.EXECUTECODE.CODE_200, roles);
    }
}
